<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        #parent{
            width: 200px;
            height: 200px;
            background: red;
        }
        #child{
            height: 100px;
            width: 100px;
            background: pink;
            margin: 50px;
        }
    </style>
</head>
<body>
    <div id="parent">
        <div id="child"></div>
    </div>
    <script>
        /* 事件捕获:从不太具体的节点接收事件，而具体的节点去响应事件 */
        /* onclick--直接绑定的方式，只会触发一次
        addEventListener(event,function,boolean)
        移除事件监听
        removeEventListener
         */
        var parent=document.getElementById("parent");
        var child=document.getElementById("child");
        child.addEventListener('click',function(){
            console.log(1)
        })
        child.addEventListener('click',function(){
            console.log(2)
        })
    </script>
</body>
</html>